// import { useLocation } from "react-router-dom"
// import { useSearchParams } from "react-router-dom"
// export default function Info(){
//     // let {name,price} = useLocation().state;
//     let [search,setSearch] = useSearchParams();
//     let name = search.get("name");
//     let price = search.get("price");
//     return (
//         <div>
//             <h1>详情页---{name}--{price}</h1>
//         </div>
//     )
// }
import WithRouter from "../router/withRoute";
import { Component } from "react";
class Info extends Component{
    state={
        name:"",
        price:""
    }
    render(){
        return (
            <div>
                <h1>详情---{this.state.name}----{this.state.price}</h1>
            </div>
        )
    }
    componentDidMount(){
        console.log(this.props)
        let name = this.props.router.search.get("name");
        let price = this.props.router.search.get("price")
        this.setState({
            name:name,
            price:price
        })
    }
}
export default WithRouter(Info) 